# import http.server, ssl
# from http.server import BaseHTTPRequestHandler 
# import http.server, ssl
# import http.client
# import os
# import json


# class RequestHandler(BaseHTTPRequestHandler):
#     def send_content(self, page, status =200):
#         self.send_response(status)
#         self.send_header("Content-type","text/html")
#         self.send_header("Content-Length",str(len(page)))
#         self.end_headers()
#         print("page",page)
#         print("self",self)
#         if type(page) == type('a'):
#             self.wfile.write(bytes(page,encoding = 'utf-8'))
#         elif type(page) == type(b'1'):
#             self.wfile.write(page)
#         # print("response: ",page)
#     # def runapp(self, path, query):
#     #     try:
#     #         res =subprocess.check_output("python %s %s"%(path, query),
#     #                                     stderr= subprocess.STDOUT,
#     #                                     shell= True)
#     #         self.send_content(res)
#     #     except subprocess.CalledProcessError as exc:
#     #         res = "returncode:%r<br/>" % exc.returncode
#     #         res += "cmd: %s<br/>"% exc.cmd
#     #         res += "output:%s<br/>" % exc.output
#     #         self.send_content(res)
#     def do_GET(self):
#         req = json.dumps("Hello, World") 
#         self.send_content(req)
 
# server_address = ('127.0.0.1', 4443)
# httpd = http.server.HTTPServer(server_address, RequestHandler)
# httpd.socket = ssl.wrap_socket(httpd.socket,
#                                server_side=True,
#                                certfile='..\cert.pem',
#                                keyfile="..\key.key",
#                                ssl_version=ssl.PROTOCOL_TLSv1_2)
# httpd.serve_forever()



# from flask import Flask
# app = Flask(__name__)
# @app.route("/", methods=['GET','POST'])
# def index():
#     return 'hello world'
# if __name__ == '__main__':
#     app.run('127.0.0.1',port=4443,ssl_context=('..\cert.pem','..\key.key'))



import json
from gevent import pywsgi
from flask import Flask
# import requests
 
# requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS = 'ALL'

app = Flask(__name__)
app.debug = True

@app.route("/", methods=['GET','POST'])
def index():
    req = json.dumps("Hello, World") 
    return(req)

if __name__ == "__main__":
    app.config["SECRET_KEY"] = "ITSASECRET"
    http_server = pywsgi.WSGIServer(('127.0.0.1', 4443), app, keyfile='..\key.key',certfile='..\cert.pem')
    http_server.serve_forever()